import {request} from './request.js';
import { URL } from '../../config.js';
// 获取公告通知信息
export const getNoticeList=()=>{
	// console.log("getNoticeList")
	 return request(
		 'notice',
		 'getList',
		 {
			url:URL+'/training/push/notice/list',
			method:'get',//请求方式
			header:{},
			token:'',
			data:{}
		 },
	) 
}
// 获取课程分类信息
export const getCategoryList=()=>{
	return request(
		'product',
		 'getCategory',
		 {
			 url:URL+'/training/course/attributeCourse/list',
			 method:'get',//请求方式
			 token:'',
			 data:{}
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 根据id获取课程详细信息
export const getCourseDetail=(id)=>{
	return request(
		'product',
		 'getCategory',
		 {
			 url:URL+'/training/course/content/search',
			 method:'get',//请求方式
			 token:'',
			 data:{
				 id:id
			 }
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 登录
export const userLogin=(userObj)=>{
	return request(
		'user',
		 'login',
		 {
			 url:URL+'/training/user/login',
			 method:'get',//请求方式
			 token:'',
			 data:{
				 ...userObj
			 }
		 },
		 {
			cache: 60*60*0,
		},
	)
}
//注册
export const registerUser=(userObj)=>{
	return request(
		'user',
		 'update',
		 {
			 url:URL+'/training/user/student/add',
			 method:'post',//请求方式
			 token:'',
			 data:{
				 ...userObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}
//修改个人信息
export const updateUserInfo=(userObj)=>{
	return request(
		'user',
		 'update',
		 {
			 url:URL+'/training/user/student/info/update',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				 ...userObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}

//获取个人信息
export const getUserInfo=()=>{
	return request(
		'user',
		 'update',
		 {
			 url:URL+'/training/user/student/info/list',
			 method:'get',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{},
			 contentType:''
		 },
		 {
			cache: 60*60*0,
		},
	)
}
//修改密码
export const updatePassword=(userObj)=>{
	return request(
		'user',
		 'update',
		 {
			 url:URL+'/training/user/password/update',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				 ...userObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}

//报名课程
export const addInformation=(informationObj)=>{
	return request(
		'order',
		 'payOrder',
		 {
			 url:URL+'/training/user/information/add',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				...informationObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}

//检查报名报名课程情况
export const CheckAddInformation=(informationObj)=>{
	return request(
		'order',
		 'payOrder',
		 {
			 url:URL+'/training/user/information/checkAdd',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				...informationObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 更新订单数量
export const getOrderCount=()=>{
	return request(
		'order',
		 'getOrderCount',
		 {
			 url:URL+'/training/information/student/list',
			 method:'get',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
			 },
			 contentType:''
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 学员取消退课
export const cancelInfoStatus=(id)=>{
	return request(
		'order',
		 'cancelOrder',
		 {
			 url:URL+'/training/student/information/status/cancel',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				 id
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 学员取消退课
export const updateInfoStatus=(id)=>{
	return request(
		'undateOrder',
		 'undateOrder',
		 {
			 url:URL+'/training/student/information/status/update',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				 id
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 根据关键字获取课程信息
export const searchCourse=(courseObj)=>{
	return request(
		'search',
		 'searchCourse',
		 {
			 url:URL+'/training/student/curriculum/search',
			 method:'get',//请求方式
			 token:'',
			 data:{
				...courseObj
			 },
			 contentType:''
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 获取推荐课程信息
export const getRecommended=()=>{
	return request(
		'recommended',
		 'getRecommended',
		 {
			 url:URL+'/training/student/course/list',
			 method:'get',//请求方式
			 token:'',
			 data:{}
		 },
		 {
			cache: 60*60*0,
		},
	)
}
//意见反馈
export const addFeedback=(feedbackObj)=>{
	return request(
		'order',
		 'payOrder',
		 {
			 url:URL+'/training/student/feedback/add',
			 method:'post',//请求方式
			 token:uni.getStorageSync('uniIdToken'),
			 data:{
				...feedbackObj
			 },
			 contentType:'application/x-www-form-urlencoded'
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 获取讲师信息
export const getTeacherList =()=>{
	return request(
		'teacher',
		 'getTeacher',
		 {
			 url:URL+'/training/student/get/teacher/list',
			 method:'get',//请求方式
			 token:'',
			 data:{}
		 },
		 {
			cache: 60*60*0,
		},
	)
}
// 获取精选文章信息
export const getArticleList=()=>{
	// console.log("getNoticeList")
	 return request(
		 'article',
		 'getArticle',
		 {
			url:URL+'/training/student/push/article/list',
			method:'get',//请求方式
			header:{},
			token:'',
			data:{}
		 },
	) 
}

// 获取讲师信息
export const getTeacherDetail= (id)=>{
	return request(
		'teacher',
		 'teacherDetail',
		 {
			 url:URL+'/training/teacher/searchById',
			 method:'get',//请求方式
			 token:'',
			 data:{
				 id
			 }
		 },
		 {
			cache: 60*60*0,
		},
	)
}

// 获取讲师信息
export const getArticleDetail= (articleObj)=>{
	return request(
		'article',
		 'articleDetail',
		 {
			 url:URL+'/training/push/detail/byId',
			 method:'get',//请求方式
			 token:'',
			 data:{
				 ...articleObj
			 }
		 },
		 {
			cache: 60*60*0,
		},
	)
}